/*
day371 
2020.9.2 
*/
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std; 


class Solution {
public:
    int rangeSum(vector<int>& nums, int n, int left, int right) {
		int length=n*(n+1)/2;
		vector<int> sums;
		for(int i=0;i<n;++i)
		{
			int sum=0;
			for(int j=i;j<n;++j)
			{
				sum+=nums[j];
				sums.push_back(sum);
			}
		}
		
		sort(sums.begin(),sums.end());
		
		int MOD=1e9 + 7;
		int res=0;
		for(int i=left-1;i<right;++i)
		{
			res+=sums[i];
			res%=MOD;
		}
		
		return res;
    }
};

int main()
{
	return 0;
}
